#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    QPushButton* button=new  QPushButton (this);
    button->setText("按钮");
    button->move(100,100);

    connect(button,&QPushButton::clicked,this,&Widget::handleClicked);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::handleClicked()
{
    if(windowTitle()=="1")
    this->setWindowTitle("2");
    else
    this->setWindowTitle("1");

}

